import { pget, ppostJson, ppost } from '@/utils/req'
import { modalApi } from '@/utils/modalReq'
/**
 * 渠道列表数据
 * @param query
 * @returns
 */
export async function getList(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/listByPage`, params)
}
/**
 * 线索列表数据
 * @param query
 * @returns
 */
export async function getClueList(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/clue/page`, params)
}

export async function getDitchList(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/listByPage`, params)
}

// 查询一级渠道类型
export async function getFirstChannelType(): Promise<any> {
	return pget(`${modalApi.sales}/sale/clue/getFirstChannelType`)
}

// 查询二级渠道类型
export async function getSecondChannelType(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/clue/getSecondChannelType`, params)
}

// 生成编码
export async function createNo(): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/createNo`)
}

// 渠道新增
export function addDitch(data: any) {
	return ppostJson(`${modalApi.sales}/sale/ditch/save`, data)
}

// 渠道详情
export async function getDitchDetail(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/detail`, params)
}

// 列表启用禁用
export async function updateStatus(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/update/status`, params)
}

// 修改渠道
export async function updateChannel(params: any): Promise<any> {
	return ppostJson(`${modalApi.sales}/sale/ditch/update`, params)
}

// 校验司机手机号返回司机信息
export async function checkDriverPhone(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/checkDriverPhone`, params)
}

// 校验车队手机号返回车队信息
export async function checkFleetPhone(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/checkFleetPhone`, params)
}

//  渠道code码表
export async function getCodeList(params: any): Promise<any> {
	return pget(`${modalApi.sales}/ditch/code/list`, params)
}

// 修改 渠道code码
export async function update(params: any): Promise<any> {
	return ppostJson(`${modalApi.sales}/ditch/code/update`, params)
}

// 删除 渠道code码
export async function remove(params: any): Promise<any> {
	return ppost(`${modalApi.sales}/ditch/code/remove?ids=${params.ids}`)
}

// 新增code码
export async function saveBitchCode(params: any): Promise<any> {
	return ppostJson(`${modalApi.sales}/ditch/code/save`, params)
}

// 订单获取渠道信息
/**
 * 渠道列表数据
 * @param query
 * @returns
 */
export async function getLists(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/getChannelNameByDriverId`, params);
}
/**
 * 线索列表数据
 * @param query
 * @returns
 */
export async function getClueLists(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/clue/getClueIntoOrder`, params);
}
/**
 * 跟单BD列表数据
 * @param query
 * @returns
 */
export async function getBDLists(params: any): Promise<any> {
	return pget(`${modalApi.sales}/sale/ditch/getChannelHaveCodeValue`, params);
}


